<?php

	namespace app\common\listener;

	use app\Request;
	use think\exception\HttpResponseException;
    use think\facade\Log;
    use think\Response;

	class AppInit
	{
		public function handle(Request $request)
		{
			if ('/install.php' != $request->server('SCRIPT_NAME') && !is_file(app()->getRootPath() . 'data' . DIRECTORY_SEPARATOR . 'install.lock')) {
				$response = Response::create('install/Index/Index', 'redirect', 302);
				throw new HttpResponseException($response);
			}
		}
	}